<test>

    <settings>
        <allow_experimental_map_type>1</allow_experimental_map_type>
    </settings>

    <substitutions>
        <substitution>
            <name>key_suffix</name>
            <values>
                <value>''</value>
                <value>'-miss'</value>
            </values>
        </substitution>
    </substitutions>

    <create_query>
CREATE TABLE column_map_test
ENGINE = MergeTree ORDER BY number
AS
SELECT number, map
FROM
(
    SELECT
        number,
        arrayMap(x -> toString(x), range(100)) AS keys,
        arrayMap(x -> toString(x * x), range(100)) AS values,
        cast((keys, values), 'Map(String, String)') AS map
    FROM numbers_mt(10000)
)
SETTINGS max_insert_threads = 8
    </create_query>

    <fill_query>optimize table column_map_test final</fill_query>

    <query>SELECT count() FROM column_map_test WHERE NOT ignore(arrayMap(x -> map[CONCAT(toString(x), {key_suffix})], range(0, 100, 10)))</query>

    <drop_query>DROP TABLE IF EXISTS column_map_test</drop_query>
</test>
